home *** CD-ROM | disk | FTP | other *** search
- ' Global Memory Flags
- Global Const GMEM_FIXED = &H0
- Global Const GMEM_MOVEABLE = &H2
- Global Const GMEM_NOCOMPACT = &H10
- Global Const GMEM_NODISCARD = &H20
- Global Const GMEM_ZEROINIT = &H40
- Global Const GMEM_MODIFY = &H80
- Global Const GMEM_DISCARDABLE = &H100
- Global Const GMEM_NOT_BANKED = &H1000
- Global Const GMEM_SHARE = &H2000
- Global Const GMEM_DDESHARE = &H2000
- Global Const GMEM_NOTIFY = &H4000
- Global Const GMEM_LOWER = GMEM_NOT_BANKED
-
- Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)
- Global Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
-
- Declare Function GlobalAlloc Lib "Kernel" (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer
- Declare Function GlobalCompact Lib "Kernel" (ByVal dwMinFree As Long) As Long
- Declare Function GlobalFree Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalHandle Lib "Kernel" (ByVal wMem As Integer) As Long
- Declare Function GlobalLock Lib "Kernel" (ByVal hMem As Integer) As Long
- Declare Function GlobalReAlloc Lib "Kernel" (ByVal hMem As Integer, ByVal dwBytes As Long, ByVal wFlags As Integer) As Integer
-
- 'NOTE: instead of declaring the function GlobalDiscard and calling
- ' GlobalDiscard(hMem), call GlobalReAlloc(hMem, 0, GMEM_MOVEABLE)
-
- Declare Function GlobalSize Lib "Kernel" (ByVal hMem As Integer) As Long
- Declare Function GlobalUnlock Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function UnlockResource Lib "Kernel" Alias "GlobalUnlock" (ByVal hMem As Integer) As Integer
- Declare Function GlobalFlags Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalWire Lib "Kernel" (ByVal hMem As Integer) As Long
- Declare Function GlobalUnWire Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalUnlock Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalLRUNewest Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalLRUOldest Lib "Kernel" (ByVal hMem As Integer) As Integer
- Declare Function GlobalPageLock Lib "Kernel" (ByVal wSelector As Integer) As Integer
- Declare Function GlobalPageUnlock Lib "Kernel" (ByVal wSelector As Integer) As Integer
- Declare Sub GlobalFix Lib "Kernel" (ByVal hMem As Integer)
- Declare Function GlobalUnfix Lib "Kernel" (ByVal hMem As Integer) As Integer
-
- ' Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE)
- Global Const GMEM_DISCARDED = &H4000
- Global Const GMEM_LOCKCOUNT = &HFF
-
- Declare Function LockSegment Lib "Kernel" (ByVal wSegment As Integer) As Integer
- Declare Function UnlockSegment Lib "Kernel" (ByVal wSegment As Integer) As Integer
-
- Declare Function lstrcpy Lib "Kernel" (ByVal lpString1 As Any, ByVal lpString2 As Any) As Long
- Declare Sub hmemcpy Lib "kernel" (ByVal hpvDest As Any, ByVal hpvSource As Any, ByVal cbCopy As Long)
-
- Function CreateGlobalBuffer (valueGlobalBuffer$, hGlobalBuffer%, lpszGlobalBuffer&, addrGlobalBuffer&) As Integer
-
- hGlobalBuffer% = GlobalAlloc(GHND, Len(valueGlobalBuffer$) + 1)
- If hGlobalBuffer% <> 0 Then
- lpszGlobalBuffer& = GlobalLock(hGlobalBuffer%)
- If lpszGlobalBuffer& <> 0& Then
- addrGlobalBuffer& = lstrcpy(lpszGlobalBuffer&, valueGlobalBuffer$)
- CreateGlobalBuffer = True
- End If
- End If
-
- End Function
-
- Sub DestroyGlobalBuffer (hGlobalBuffer%)
-
- rci% = GlobalUnlock(hGlobalBuffer%)
- rci% = GlobalFree(hGlobalBuffer%)
-
- End Sub
-
-